package com.koron.plan.config;

import java.util.HashMap;
import java.util.Map;

/**
 * @author twcao
 * @title: Constants
 * @projectName GDH_EAM_V2
 * @description: 生产计划常量
 * @date 2021/9/618:14
 */
public class Constants {

    public static final class YesOrNo {
        public static final Integer YES = 1;
        public static final Integer NO = 0;
    }

    /**
     * 维保计划 编号前缀
     */
    public static final String MAINTAIN_PLAN_PREFIX = "WB";
    public static final String EXPERIMENT_PLAN_PREFIX = "SY";
    /**
     * 检修计划包编号前缀
     */
    public static final String REPAIR_PACKAGE_PREFIX = "JHB";

    public static final String DEPT_NAME_KEY = "DEPT_NAME";

    public static final String PATROL_POINT_PREFIX = "XSD";

    public static final String PATROL_PREFIX = "XS";

    public static final String LINE_PATROL_PREFIX = "XLXS";

    /**
     * 巡视工单生成时候的状态
     */
    public static final String PATROL_ORDER_INIT_STATUS = "WAIT_PATROL";

    /**
     * 计划即将过期的时长
     */
    public static final long PLAN_EXPIRING_DURATION = 3 * 24 * 3600;

    /**
     * 安装位置的编码
     */
    public static final String LOCATION_CODE = "0001000";

    public static final class OrderType {
        // 正常维护工单
        public static final String MAINTAIN = "maintain";
        public static final String EXPERIMENT = "experiment";
    }

    /**
     * 维保计划状态，草稿
     */
    public static final class MAINTAIN_PLAN_STATE {
        // 草稿
        public static final Integer DRAFT = 0;
        // 已启用
        public static final Integer USING = 1;
        // 待审核
        public static final Integer WAIT_REVIEW = 2;

        public static final Integer DISABLED = -1;
    }

    /**
     * 巡视计划状态，草稿
     */
    public static final class PATROL_PLAN_STATE {
        // 草稿
        public static final Integer DRAFT = 0;
        // 已启用
        public static final Integer USING = 1;
    }

    /**
     * 检修计划包状态
     *  0：草稿（默认）、1：待审核、2：审核完成、3：执行中、4：已完成
     */
    public static final class REPAIR_PACKAGE_STATE {
        // 草稿
        public static final Integer DRAFT = 0;
        // 待审核
        public static final Integer TO_AUDIT = 1;
        // 审核完成
        public static final Integer AUDITED = 2;
        // 执行中
        public static final Integer EXECUTION = 3;
        // 已完成
        public static final Integer FINISH = 4;
    }

    /**
     * 保存事件状态
     */
    public static final class REPAIR_PACKAGE_EVENT_KEY {
        // 初始化之前
        public static final String INITIALIZE_BEFORE = "initialize_before";
        // 保存之前
        public static final String SAVE_BEFORE = "save_Before";
        // 保存之后
        public static final String SAVE_AFTER = "save_after";
    }

    /**
     * 工作流参数
     */
    public static final class REPAIR_PACKAGE_WORKFLOW {

        public static final String APP_CODE = "gdheam";

        public static final String SET_CODE = "plan";

        public static final String PROCESS_CODE = "repair_plan_package";
    }

    /**
     * 检修计划状态，默认待下发
     */
    public static final class REPAIR_PACKAGE_ISSUE_STATE {
        // 草稿
        public static final Integer DRAFT = 0;
        // 待审核
        public static final Integer WAIT_REVIEW = 1;
        // 待下发
        public static final Integer TO_ISSUE = 2;
        // 已下发
        public static final Integer ISSUED = 3;
        // 执行中
        public static final Integer EXECUTE = 4;
        // 已完成
        public static final Integer FINISH = 5;
    }

    /**
     * 检修计划工作类别
     */
    public static final class ISSUE_JOB_TYPE {
        // 大修
        public static final String OVERHAUL = "overhaul";
        // 试验
        public static final String EXPERIMENT = "experiment";
        // 计划性检修计划
        public static final String REPAIR = "repair";
        // 编码前缀
        public static Map<String, String> prefixMap = new HashMap<>();

        static {
            // 大修
            prefixMap.put(OVERHAUL, "DX");
            // 实验
            prefixMap.put(EXPERIMENT, "SY");
            // 检修
            prefixMap.put(REPAIR, "JX");
        }
    }

    /**
     * 计划状态红绿灯
     */
    public static final class Signal {
        // 【状态不为已归档，且计划结束时间-当前时间>3天】或【状态为已归档，且实际结束时间≤计划结束时间】
        public static final String ON_TIME = "#95F204";

        // 【状态不为已归档，且计划结束时间>当前时间，且计划结束时间-当前时间<=3天】
        public static final String EXPIRING = "#FFFF00";

        // 【状态不为已归档，且当前时间≥计划结束时间】或【状态为已归档，且实际结束时间>计划结束时间】
        public static final String EXPIRED = "#D9001B";
    }

    /**
     * 巡视点类型
     */
    public static final class PatrolType {
        public static final String EQUIPMENT = "equipment";
        public static final String EQUIPMENT_ROOM = "equipment_room";
    }

    public static final class Major {
        // 电气
        public static final String ELECTRIC = "electric";
        // 机械
        public static final String MACHINE = "machine";
        // 其他
        public static final String OTHERS = "others";
        // 通讯
        public static final String COMMUNICATION = "communication";
        // 自动化
        public static final String AUTOMATE = "automate";
        // 综合
        public static final String SYNTHESIS = "synthesis";
    }

    public static final class OrderSource {
        // 手工录入
        public static final String ENTER_ORDER = "enter_order";
        // 复制产生
        public static final String COPY_ORDER = "copy_order";
        // 计划产生
        public static final String PLAN_ORDER = "plan_order";
        public static Map<String, String> orderSourceMap = new HashMap<>();
        static {
            orderSourceMap.put(ENTER_ORDER, "手工录入");
            orderSourceMap.put(COPY_ORDER, "复制产生");
            orderSourceMap.put(PLAN_ORDER, "计划产生");
        }
    }

    public static final class StaffingWay {
        //值班长+值班员
        public static final String MONITOR_OFFICER = "monitor_officer";
        //值班员
        public static final String ATTENDANT = "attendant";
        //值守
        public static final String UNATTENDED = "unattended";
        //指定
        public static final String APPOINT = "appoint";
        // AMD根据排班表
        public static final String SHIFT_FORM = "baseonjob";


        public static Map<String, String> map = new HashMap<>();

        static {
            // 值班长+值班员 => 0
            map.put(MONITOR_OFFICER, "0");
            // 值守 => 1
            map.put(UNATTENDED, "1");
            // 值班员 => 2
            map.put(ATTENDANT, "2");
        }
    }
}
